
/**
 * Created by losor on 2017/3/5.
 */
public class _453_MinimumMovesToEqualArrayElements {

    public static void main(String[] args) {
        int[] a = {1,2,3};
        System.out.println(minMoves(a));
    }
    public static int minMoves(int[] nums) {
        int min = nums[0];
        for (int i = 0; i < nums.length; i++) {
            if (min>nums[i]){
                min = nums[i];
            }
        }
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum += nums[i] - min;
        }
        return sum;
    }

}
